package com.cn.controller;

import com.cn.api.ApiResult;
import com.cn.pojo.shop.ShopCate;
import com.cn.service.ShopCateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 商品分类接口
 */
@RestController
@RequestMapping("/cate")
public class CateController {

    @Autowired
    private ShopCateService shopCateService;

    /**
     * 查询分类信息
     * @return
     */
    @GetMapping("/queryCate")
    private ApiResult queryCate(){
        return shopCateService.queryCate();
    }

    /**
     * 修改分类信息
     * @param shopCate
     * @return
     */
    @PutMapping("/updateCate")
    private ApiResult updateCate(@RequestBody ShopCate shopCate){
        return  shopCateService.updateCate(shopCate);
    }

    /**
     * 删除分类
     * @param id
     * @return
     */
    @DeleteMapping("/deleteCate/{id}")
    public ApiResult deleteCate(@PathVariable("id") Integer id){
        return shopCateService.deleteCate(id);
    }

    /**
     * 增加分类
     * @param shopCate 分类
     * @return
     */
    @PostMapping("/addCate")
    public ApiResult addCate(@RequestBody ShopCate shopCate){
        return shopCateService.addCate(shopCate);
    }



}
